commit bed8f03202336fc7863ec6a39e130473f59061c6
Author: Sergey 'Jin' Bostandzhyan <jin at mediatomb dot cc>
Date:   Sun Jan 27 23:08:04 2013 +0100

    Extra configure check for libmp4v2 compatibility
    
    We do not support the newer libmpv2 version yet, so don't error out when
    compiling, catch it in configure.

diff --git a/acinclude.m4 b/acinclude.m4
index f4962c6..3cc5ec3 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -533,7 +533,8 @@ AC_DEFUN([MT_CHECK_OPTIONAL_PACKAGE],
         AC_MSG_ERROR([unable to configure $1 support])
     fi
 
-    if test "x$mt_[]translit($1, `/.-', `___')_status" = xyes; then
+    if ((test "x$mt_[]translit($1, `/.-', `___')_status" = xyes) &&
+        (test "x$9" != "xundef")); then
         AC_DEFINE(translit(HAVE_$1, `a-z/.-', `A-Z___'), [1], [$1 library presence])
     fi
     
diff --git a/configure.ac b/configure.ac
index e72dd78..9241797 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1390,7 +1390,7 @@ LIBMP4V2_STATUS=
 
 MT_CHECK_OPTIONAL_PACKAGE([libmp4v2], [disable],
                  [libmp4v2 support for mp4 metadata extraction],
-                 [$MP4_HEADER], [mp4v2], [MP4Read]) 
+                 [$MP4_HEADER], [mp4v2], [MP4Read], [], [], [undef]) 
 
 if test "x$LIBMP4V2_STATUS" = xyes; then
    CFLAGS="$CFLAGS $LIBMP4V2_CFLAGS"
@@ -1399,6 +1399,37 @@ if test "x$LIBMP4V2_STATUS" = xyes; then
    AC_DEFINE_UNQUOTED([LIBMP4V2_INCLUDE], [<$MP4_HEADER.h>], [$MP4_HEADER.h])
    AC_LANG_SAVE
    AC_LANG_CPLUSPLUS
+   AC_MSG_CHECKING([for libmp4v2 compatibility])
+   AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM(
+            [
+                #include <$MP4_HEADER.h>
+            ],
+            [
+                (void)MP4GetMetadataName(0, 0);
+            ]
+        )],
+        [
+            AC_MSG_RESULT([yes])
+            AC_DEFINE([HAVE_LIBMP4V2], [1], [libmp4v2 library presence])
+        ],
+        [
+            AC_MSG_RESULT([not compatible])
+            if test "x$LIBMP4V2_OPTION_REQUESTED" = "xyes"; then
+                AC_MSG_ERROR([Unable to configure libmp4v2 support])
+            else
+                LIBMP4V2_STATUS="not compatible"
+            fi
+        ])
+    LDFLAGS="$LDFLAGS_SAVE"
+    CFLAGS="$CFLAGS_SAVE"
+    CXXFLAGS="$CXXFLAGS_SAVE"
+fi
+
+if test "x$LIBMP4V2_STATUS" = "xyes"; then
+   CFLAGS="$CFLAGS $LIBMP4V2_CFLAGS"
+   CXXFLAGS="$CXXFLAGS $LIBMP4V2_CFLAGS"
+   LDFLAGS="$LDFLAGS $LIBMP4V2_LDFLAGS $LIBMP4V2_LIBS"
    AC_MSG_CHECKING([for MP4GetMetadataCoverArtCount() in libmp4v2])
    AC_COMPILE_IFELSE(
         [AC_LANG_PROGRAM(
@@ -1437,7 +1468,10 @@ if test "x$LIBMP4V2_STATUS" = xyes; then
             AC_MSG_RESULT([no])
         ])
 
-   AC_LANG_RESTORE
+    AC_LANG_RESTORE
+    LDFLAGS="$LDFLAGS_SAVE"
+    CFLAGS="$CFLAGS_SAVE"
+    CXXFLAGS="$CXXFLAGS_SAVE"
 fi
 
 ########## INOTIFY TOOLS
